#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;


void solve() {
    int n;
    cin >> n;
    string s1, s2;
    for(int i = 0; i < n; i++) {
        if(i & 1) s1 += "..";
        else s1 += "##";
    }
    for(int i = 0; i < n; i++) {
        if(i & 1) s2 += "##";
        else s2 += "..";
    }
    for(int i = 0; i < n; i++) {
        if(i & 1) cout << s2 << '\n' << s2 << '\n';
        else cout << s1 << '\n' << s1 << '\n';
    }
}

int main() {
    int t = 1;
    cin >> t;
    while(t--) solve();
    return 0;
}